home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Frameworks / Hsoi's App Shell 1.0a4 / Hsoi's App Shell Headers / HASHelp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-28  |  4.3 KB  |  164 lines  |  [TEXT/CWIE]

  1. /*
  2.     HASHelp.h from Hsoi's App Shell. © 1995-1997 John C. Daub.  All rights reserved.
  3.     
  4.     This is the corresponding header file to HASHelp.c.  Contains declarations,
  5.     marcos, UPP's, function prototypes, etc etc.
  6.     
  7.     Do see the header comments in HASHelp.c for more information and help in using
  8.     this file
  9. */
  10.  
  11. #ifndef __DIALOGS__
  12. #include <Dialogs.h>
  13. #endif
  14. #ifndef __CONTROLS__
  15. #include <Controls.h>
  16. #endif
  17.  
  18. #ifndef _WASTE_
  19. #include "WASTE.h"
  20. #endif
  21.  
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. #if PRAGMA_ALIGN_SUPPORTED
  28. #pragma options align=mac68k
  29. #endif
  30.  
  31.  
  32. // since not everyone might want to use inline objects (PICTs, snd's, etc) provided
  33. // by WASTE's 'SOUP' resource, we'll have this flag.  If you use objects in your
  34. // help text, set this to one (1).  if you do NOT use objects (no SOUP), be sure to
  35. // set this to zero (0) else things won't work.
  36.  
  37. #ifndef WASTE_OBJECTS
  38. #define USE_SOUP         0
  39. #endif
  40.  
  41. #if !WASTE_OBJECTS
  42. #define USE_SOUP        0
  43. #else
  44. #define USE_SOUP        1
  45. #endif
  46.  
  47. #define    PREFLIGHT_MEMORY        20000L
  48.  
  49.  
  50.  
  51. // callback procs
  52.  
  53. typedef pascal Boolean (*HsoiUpdateProcPtr)( WindowRef whatWindow );
  54. typedef pascal void (*HsoiBeginHelpProcPtr)( WindowRef whatWindow );
  55.  
  56. // upp proc info
  57.  
  58. enum {
  59.     uppHsoiHelpUpdateProcInfo = kPascalStackBased
  60.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  61.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WindowRef /*whatWindow*/)))
  62. };
  63.  
  64. enum {
  65.     uppHsoiBeginHelpProcInfo = kPascalStackBased
  66.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WindowRef /*whatWindow*/)))
  67. };
  68.  
  69. // UPP's
  70.  
  71. #if GENERATINGCFM    // if you're generating PowerMac (PowerPC) native code, this will
  72.                     // be true. (it'd also be true if you're generating CFM68K stuff
  73.  
  74. typedef UniversalProcPtr HsoiHelpUpdateUPP;
  75. typedef UniversalProcPtr HsoiBeginHelpUPP;
  76.  
  77. #define NewHsoiHelpUpdateProc(userRoutine) \
  78.     (HsoiHelpUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppHsoiHelpUpdateProcInfo, GetCurrentArchitecture() )
  79.  
  80. #define NewHsoiBeginHelpProc(userRoutine) \
  81.     (HsoiBeginHelpUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppHsoiBeginHelpProcInfo, GetCurrentArchitecture() )
  82.  
  83. #define CallHsoiHelpUpdateProc( userRoutine, whichWindow ) \
  84.     CallUniversalProc( (UniversalProcPtr)(userRoutine), uppHsoiHelpUpdateProcInfo, (whichWindow) )
  85. #define CallHsoiBeginHelpProc( userRoutine, whichWindow ) \
  86.     CallUniversalProc( (UniversalProcPtr)(userRoutine), uppHsoiBeginHelpProcInfo, (whichWindow) )
  87.  
  88. #else
  89.  
  90. typedef HsoiUpdateProcPtr         HsoiHelpUpdateUPP;
  91. typedef HsoiBeginHelpProcPtr    HsoiBeginHelpUPP;
  92.  
  93. #define NewHsoiHelpUpdateProc(userRoutine) ((HsoiHelpUpdateUPP)(userRoutine))
  94. #define NewHsoiBeginHelpProc(userRoutine) ((HsoiBeginHelpUPP)(userRoutine))
  95.  
  96. #define CallHsoiHelpUpdateProc( userRoutine, whichWindow ) \
  97.     (*(userRoutine))((whichWindow))
  98. #define CallHsoiBeginHelpProc( userRoutine, whichWindow ) \
  99.     (*(userRoutine))((whichWindow))
  100.  
  101. #endif
  102.  
  103. // this struct (HelpRecord) holds information about our dialog...stuff that
  104. // we'd like to have easy access to.  a Handle to this information is
  105. // stored in the dialog's refCon field.
  106.  
  107. typedef struct {
  108.     DialogRef            dialog;
  109.     ControlRef            scrollbar;
  110.     CursHandle            ibeamCursor;
  111.     HsoiHelpUpdateUPP    handleUpdate;
  112.     WEReference            we;
  113. }    HelpRecord, *HelpPtr, **HelpHandle;
  114.  
  115. // this is the struct that holds the data/info from our 'Hso?' resource (the
  116. // resource that holds the resource ID numbers for our dialog; our TEXT, styl,
  117. // and SOUP resource; and the default strings for saved text and popup menu
  118.  
  119. typedef struct {
  120.     short        dialogID;
  121.     short        textID;
  122.     short        stylID;
  123.     short        soupID;
  124.     unsigned char strings[]; // default file name, menu text
  125. } ShowHelpInfo;
  126.  
  127.  
  128.  
  129. pascal void        HsoiShowHelp( short infoID, HsoiHelpUpdateUPP handleUpdate,
  130.                                                         HsoiBeginHelpUPP initCallback );
  131.  
  132. void            HsoiDoHelpStuff( void );
  133. pascal void        HsoiHelpModalDialog( ModalFilterUPP, short * );
  134. short             HsoiFindChar( Handle, short, char );
  135. pascal void     HsoiFlashButton( DialogRef, short );
  136.  
  137.  
  138.  
  139. // some constants for our dialog items
  140.  
  141. enum {
  142.     cOkButton = 1,    /* OK button */
  143.     cHelpRect,        /* userItem for our help display */
  144.     cSaveButton,    /* Button to save as TeachText */
  145.     cPopupMenu        /* userItem for popup menu */
  146. };
  147.  
  148.  
  149.  
  150. // and some other constant values for use by the help routines.
  151.  
  152. #define        TEXT_INSET        4
  153. #define        TYPE_HELP        'Hso?'
  154.  
  155.  
  156. #if PRAGMA_ALIGN_SUPPORTED
  157. #pragma options align=reset
  158. #endif
  159.  
  160. #ifdef __cplusplus
  161. }
  162. #endif
  163.  
  164.